package com.lfz.quality_effect.controller;


import com.lfz.quality_effect.model.dto.DeliveryRateDTO;
import com.lfz.quality_effect.model.vo.TDeliveryStatisticsVO;
import com.lfz.quality_effect.service.TDeliveryStatisticsService;
import com.lfz.quality_effect.utils.ResultData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import java.util.List;

/**
 * <p>
 * 电子送达统计信息 前端控制器
 * </p>
 *
 * @author Destiny
 * @since 2023-03-21
 */
@Api(tags = "电子送达率",value = "TDeliveryStatisticsController")
@RestController
@RequestMapping("/api/tDeliveryStatistics")
public class TDeliveryStatisticsController {

    @Autowired
    private TDeliveryStatisticsService deliveryStatisticsService;
    @ApiOperation("上传电子送达统计信息")
    @PostMapping("/uploadDelivertStatistics")
    public ResultData uploadDelivertStatistics(@RequestBody DeliveryRateDTO deliveryRateDTO){
        deliveryStatisticsService.uploadDelivertStatistics(deliveryRateDTO);
        return ResultData.ok();
    }

    @ApiOperation("电子送达——优化")
    @GetMapping("/optimizeDelivertStatistics")
    public ResultData<TDeliveryStatisticsVO> optimizeDelivertStatistics(){
        TDeliveryStatisticsVO vo = deliveryStatisticsService.optimizeDelivertStatistics();
        return ResultData.ok().data(vo);
    }
}

